package com.richmond.gui.bilan;

import com.richmond.data.bilan.BilanRecord;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableView;
import javafx.scene.paint.Color;
import javafx.util.Callback;

import java.text.DecimalFormat;
import java.text.NumberFormat;

/**
 * User: csavard
 * Date: 12-09-24
 * Time: 22:46
 */
public class MoneyFormatCell extends TableCell<BilanRecord, Double> {
 private NumberFormat numberFormat = new DecimalFormat("###,###,###,###");
    @Override
    protected void updateItem(Double item, boolean empty) {
        // calling super here is very important - don't skip this!
        super.updateItem(item, empty);

        // format the number as if it were a monetary value using the
        // formatting relevant to the current locale. This would format
        // 43.68 as "$43.68", and -23.67 as "-$23.67"
        setText(item == null ? "" : numberFormat.format(item));
    }
}